fix: subtract trailing padding in editor intrinsic size computations - #2749
Open
ndelanou wants to merge 1 commit into
Open
fix: subtract trailing padding in editor intrinsic size computations#2749ndelanou wants to merge 1 commit into
ndelanou wants to merge 1 commit into
Conversation
RenderEditableContainerBox's computeMin/MaxIntrinsicWidth and computeMin/MaxIntrinsicHeight computed the child extent as 'extent - padding.leading + padding.trailing' (missing parentheses), so with symmetric padding children were measured at the undeflated extent while performLayout deflates both sides. Under IntrinsicHeight this made the editor's reported height one line short at the exact moment a line wraps, overflowing composer-style layouts. Fixes singerdmx#2748 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ndelanou
marked this pull request as ready for review
July 7, 2026 16:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
RenderEditableContainerBox's four intrinsic size computations resolve the child's cross extent as:i.e. the leading padding is subtracted but the trailing padding is added (missing parentheses). With symmetric padding the children are measured at the full, undeflated extent, while
performLayoutcorrectly deflates both sides.Concretely, for a
QuillEditorwithpadding: EdgeInsets.symmetric(horizontal: 12)placed underIntrinsicHeight(a typical message-composer layout), text is measured 24px wider than it is laid out: a word that wraps onto a new line at layout width still fits at measure width, so the intrinsic height is exactly one line short — aRenderFlex overflowed by <one line> pixels on the bottomright at the moment a line wraps. Typing a few more characters makes the too-wide measurement wrap too and the error "heals", until the next wrap.The fix replaces the expressions with
extent - padding.horizontal/extent - padding.verticalin all four methods (computeMin/MaxIntrinsicWidth,computeMin/MaxIntrinsicHeight).Includes a regression test in
test/bug_fix_test.dartthat lays out an editor with horizontal padding and assertsgetMin/MaxIntrinsicHeight(width)equals the laid-out height (fails before the fix, passes after), plus aCHANGELOG.mdentry.Related Issues
_getIntrinsicMainAxis, not addressed here)Type of Change
🤖 Generated with Claude Code